define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_shop_info(result){
			if(false){
				result = '{"success":true,"msg":"","result":{"store_id":1,"store_name":"益达","region":"江苏省 南京市 下关区","store_type":"品牌运营商","logo":{"id":"1","image":"img/storeicon.png"},"store_info":[{"name":"描述相符","avg_point":4.2,"avg_percent":80},{"name":"服务态度","avg_point":4.3,"avg_percent":80},{"name":"发货速度","avg_point":4.4,"avg_percent":80}],"store_level":"1-1"}}';
				return JSON.parse(result);
			}else
			return result;
		}
		function get_data_add_store(result){
			if(HTTP_ISLOGIC){
				result = '{"success":true,"msg":"","session":"7311da98bd0f18eb15a96bcb263f4153","result":{"store_id":1}}';
				return JSON.parse(result);
			}else
			return result;
		}

		//返回信息
		return {
			//店铺信息
			shop_info:function(store_id,callback){
				Http.post({
					method:'shop.getstore.detail',
					store_id:store_id
				},function(result){
					if(callback)
					callback(get_data_shop_info(result).result);
				},function(e){

				},function(){

				})
			},
			//添加收藏
			add_store:function(store_id,callback){
				Http.post({
					method:'member.favorite.addstore',
					store_id:store_id
				},function(result){
					if(callback)
					callback(get_data_add_store(result));
				},function(e){

				},function(){

				})
			}
			
			
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Shopinfo", factory);
});